package io.vertx.core.ioc;

public abstract class Lazy <T> {
    private T t;
    public T get() {
        if(t == null) {
            t = create();
        }
        return t;
    }
    protected abstract T create();

    public void doDestroy(T t){}

    public final void destroy() {
        if(t != null) {
            doDestroy(t);
        }
    }
}